<div class="editcate_top">
    <h2>Edit gallery</h2>
    <a href="javascript:void(0)" onclick ="$('#light_adct').hide();$('#fade_adct').hide()"><img src="<?php echo img_link('close.png', 'admin'); ?>" class="png" /></a>
</div>

<div id="div_message"></div>

<form enctype="multipart/form-data" method="post" action="<?php echo action_link('edit/'.$album->id); ?>" id="album_form">
<div class="editcate_ct">
	<div class="boxadd">
    	<ul class="linect">
            <li>
                <span class="left">Gallery ID :</span>
                <span class="right">
                        <input readonly="true" value="<?php echo $album->id; ?>" style="width:100%; margin:0;" type="text">
                </span>
            </li>
            <li>
                <span class="left"><b>Gallery name :</b></span>
                <span class="right"><input type="text" name="name" value="<?php echo $album->name; ?>" style="width:100%; margin:0;" /></span>
            </li>
            <li>
                <span class="left"><b>Description: </b></span>
                <span class="right"><textarea cols="50" rows="5" style="width:100%;" name="description"><?php echo $album->description; ?></textarea></span>
            </li>
            
            
            <?php if(count($images) > 0): ?>
            <?php foreach($images as $i => $image): ?>
            <li>
                <span class="left"><?php echo ($i == 0) ? 'Name / Description / Images:' : '&nbsp;'; ?></span>
                <span class="right">
                	<input type="text" name="images_name[<?php echo $i; ?>]" value="<?php echo $image->img_name; ?>" style="margin:0; width:60%;" /> <span style="padding:0 5px;"> - </span>
                	<input type="file" name="images[<?php echo $i; ?>]" value="" /><br />
                	<textarea name="images_description[<?php echo $i; ?>]"  style="margin:0; width:60%;"><?php echo $image->img_description; ?></textarea>
                	<input type="hidden" name="images_id[<?php echo $i; ?>]" value="<?php echo $image->id; ?>" />
                	<p><img src="<?php echo site_url($image->img_path); ?>" /></p>
                </span>
            </li>
            <?php endforeach; ?>
            <?php endif; ?>
                
            <?php for($i = 1; $i < 5; $i++): ?>
            <li>
                <span class="left"><?php echo ($i == 1 && count($images) == 0) ? 'Name / Description / Images:' : '&nbsp;'; ?></span>
                <span class="right">
                	<input type="text" name="images_name[]" value="" style="margin:0; width:60%;" /> <span style="padding:0 5px;"> - </span><input type="file" name="images[]" value="" /><br />
                	<textarea name="images_description[]"  style="margin:0; width:60%;"></textarea>
                </span>
            </li>
            <?php endfor; ?>

            <li id="add_more">
                <span class="left"><b>&nbsp;</b></span>

                <span class="right">
                	<a href="javascript:void(0)" onclick="add_more_image();"><img alt="" title="" src="<?php echo img_link('add.gif', 'admin'); ?>"></a>
                </span>
            </li>
       
        </ul>
    </div>
    <div class="btarticle">
    	<input type="button" value="Cancel" class="btn" onclick="$('#light_adct').hide();$('#fade_adct').hide();" />
        <input type="submit" value="Save & Continute" class="btn" />

    </div>
</div>
</form>
<script>
$('#album_form').iframer({
    onComplete: function(msg){
    	if(msg == 'yes') {
    		$('#light_adct').hide();$('#fade_adct').hide();
            load_content('row_<?php echo $album->id; ?>', admin_url+'album/load_row/<?php echo $album->id; ?>');
            $('.linecate2').has('#row_<?php echo $album->id; ?>').css('background-color', '#FFFFE0');
    	}
    	else show_error('div_message', msg)
    }
});
</script>